/**
 * 
 */
package edu.com.thao;

import java.util.Scanner;

/**
 * @author x401a
 *
 */

public class BlueSort2 {

	/**
	 * @param args
	 */
	private static Scanner input;

	/**
	 * @param args
	 */
	public void bubbleSort(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			for (int j = 1; j < arr.length; j++) {
				if (arr[j] < arr[j - 1]) {
					int temp = arr[j];
					arr[j] = arr[j - 1];
					arr[j - 1] = temp;
				}
			}
		}

		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		input = new Scanner(System.in);

		System.out.print("Ta có mảng là: ");
		int n = input.nextInt();
		int[] x = new int[n];

		System.out.print("Nhập " + n + " Số: ");
		for (int i = 0; i < n; i++) {
			x[i] = input.nextInt();
		}

		BlueSort access = new BlueSort();
		System.out.print("Ta có mảng đã sắp xếp là:");
		access.bubbleSort(x);
	}

}
